package com.cskaoyan.controller;

import com.cskaoyan.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.HashMap;

/**
 * @author stone
 * @date 2022/05/30 15:04
 */
//@ResponseBody
//@Controller
@RestController
public class JsonController {


    @RequestMapping("json1")
    //@ResponseBody
    public User json1() {

        User user = new User();
        user.setUsername("松哥");
        user.setPassword("李艮隶");
        return user;
    }

    @RequestMapping("json2")
    //@ResponseBody
    public HashMap json2() {

        HashMap hashMap = new HashMap();
        hashMap.put("username", "雪茄");
        hashMap.put("password", "1234567");
        hashMap.put("age", 25);
        return hashMap;
    }
}
